#include "VAO.h"
#include <glad/glad.h>
#include <GLFW/glfw3.h>

namespace OCPP
{
	VAO::VAO()
	{
		glGenVertexArrays(1, &ID);
	}

	VAO::~VAO()
	{
		glDeleteVertexArrays(1, &ID);
	}

	void VAO::linkVBO(VBO* VBO, uint32 layout, GLuint numComponents, GLenum type, GLsizeiptr stride, void* offset)
	{
		VBO->bind();
		glVertexAttribPointer(layout, numComponents, type, GL_FALSE, stride, offset);
		glEnableVertexAttribArray(layout);
		VBO->unbind();
	}

	void VAO::bind()
	{
		glBindVertexArray(ID);
	}

	void VAO::unbind()
	{
		glBindVertexArray(0);
	}
}